<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>宝邯管理平台</title>
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <link rel="stylesheet" href="${request.contextPath}/statics/css/bootstrap.min.css">
    <link rel="stylesheet" href="${request.contextPath}/statics/css/font-awesome.min.css">
    <link rel="stylesheet" href="${request.contextPath}/statics/css/AdminLTE.min.css">
    <link rel="stylesheet" href="${request.contextPath}/statics/css/all-skins.min.css">
    <link rel="stylesheet" href="${request.contextPath}/statics/css/main.css">


</head>
<body>
<body class="hold-transition login-page">
<div class="login-box" id="pmpapp" v-cloak>
    <div class="login-logo" style="font-size: 30px;">
        <b>宝邯管理系平台</b>
    </div>
    <!-- /.login-logo -->
    <div class="login-box-body">
        <p class="login-box-msg login-title">用户登录</p>
        <div v-if="error" class="alert alert-danger alert-dismissible">
            <h4 style="margin-bottom: 0px;"><i class="fa fa-exclamation-triangle"></i> {{errorMsg}} </h4>
        </div>
        <div class="form-group has-feedback">
            <input type="text" class="form-control" v-model="username" placeholder="用户名">
            <span class="glyphicon glyphicon-user form-control-feedback"></span>
        </div>
        <div class="form-group has-feedback">
            <input type="password" class="form-control" v-model="password" placeholder="密码">
            <span class="glyphicon glyphicon-lock form-control-feedback"></span>
        </div>
        <!--        <div class="form-group has-feedback">-->
        <!--            <input type="text" class="form-control" v-model="captcha" @keyup.enter="login" placeholder="验证码">-->
        <!--            <span class="glyphicon glyphicon-warning-sign form-control-feedback"></span>-->
        <!--        </div>-->
        <!--        <div class="form-group has-feedback">-->
        <!--            <img alt="如果看不清楚，请单击图片刷新！" class="pointer" :src="src" @click="refreshCode">-->
        <!--            &nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:;" @click="refreshCode">点击刷新</a>-->
        <!--        </div>-->

        <!--滑塊驗證 -->



        <div class="row">
            <div class="col-xs-8">
                <div class="checkbox icheck">
                </div>
            </div>
            <!-- /.col -->
            <div class="col-xs-4  btn-login">
                <button type="button" class="btn btn-primary btn-block btn-flat btn-login" @click="login">登录</button>
            </div>
            <!-- /.col -->
        </div>
        <!-- /.social-auth-links -->

    </div>
    <!-- /.login-box-body -->
</div>
<script src="${request.contextPath}/statics/libs/jquery.min.js"></script>
<script src="${request.contextPath}/statics/libs/vue.min.js"></script>
<script src="${request.contextPath}/statics/libs/bootstrap.min.js"></script>
<script src="${request.contextPath}/statics/libs/jquery.slimscroll.min.js"></script>
<script src="${request.contextPath}/statics/libs/fastclick.min.js"></script>
<script src="${request.contextPath}/statics/libs/app.js"></script>
<script type="text/javascript">
    var vm = new Vue({
        el: '#pmpapp',
        //输入框默认一个值
        data: {
            username: 'supadmin',
            password: '521926',
            captcha: '',
            error: false,
            errorMsg: '',
            src: ''
        },
        beforeCreate: function () {
            if (self != top) {
                top.location.href = self.location.href;
            }
        },
        methods: {
            refreshCode: function () {
                this.src = "captcha.jpg?t=" + $.now();
            },
            //点击登录，发送用户名等信息
            login: function (event) {
                var data = "username=" + vm.username + "&password=" + vm.password;
                alert(data)
                $.ajax({
                    type: "POST",
                    url: "loginVerification",
                    data: data,
                    dataType: "json",
                    success: function (result) {
                        if (result.code == 0) {
                            //登录成功
                            parent.location.href = 'index';
                        } else {
                            //登陆失败
                            vm.error = true;
                            vm.errorMsg = result.msg;

                            vm.refreshCode();
                        }
                    }
                });
            }
        }
    });
</script>
</body>
</body>
</html>